<!-- saved from url=(0014)about:internet -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>DrawSurfaceTestApp.mxml</title>
<link rel="stylesheet" type="text/css" href="../SourceStyles.css"/>
</head>

<body><pre><span class="MXMLProcessing_Instruction">&lt;?xml version="1.0" encoding="utf-8"?&gt;</span>
<span class="MXMLComponent_Tag">&lt;s:Application</span><span class="MXMLDefault_Text"> xmlns:fx="</span><span class="MXMLString">http://ns.adobe.com/mxml/2009</span><span class="MXMLDefault_Text">" 
               xmlns:s="</span><span class="MXMLString">library://ns.adobe.com/flex/spark</span><span class="MXMLDefault_Text">" 
               xmlns:mx="</span><span class="MXMLString">library://ns.adobe.com/flex/mx</span><span class="MXMLDefault_Text">"
               xmlns:surface="</span><span class="MXMLString">com.sap.coe.surface.*</span><span class="MXMLDefault_Text">" viewSourceURL="</span><span class="MXMLString">srcview/index.html</span><span class="MXMLDefault_Text">"</span><span class="MXMLComponent_Tag">&gt;</span>
    
    <span class="MXMLSpecial_Tag">&lt;fx:Declarations&gt;</span>
        <span class="MXMLComment">&lt;!--</span><span class="MXMLComment"> Place non-visual elements (e.g., services, value objects) here </span><span class="MXMLComment">--&gt;</span>
    <span class="MXMLSpecial_Tag">&lt;/fx:Declarations&gt;</span>
    
    <span class="MXMLSpecial_Tag">&lt;fx:Script&gt;</span>
        &lt;![CDATA[
            <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">com</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">sap</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">coe</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">surface</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">events</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">TraceEvent</span>;
            <span class="ActionScriptReserved">import</span> <span class="ActionScriptDefault_Text">spark</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">components</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">Group</span>;

            <span class="ActionScriptASDoc">/** Currently not used */</span>
            <span class="ActionScriptReserved">protected</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">traceStartHandler</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span> : <span class="ActionScriptDefault_Text">TraceEvent</span><span class="ActionScriptBracket/Brace">)</span> : <span class="ActionScriptReserved">void</span>
            <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptComment">// TODO Auto-generated method stub
</span>            <span class="ActionScriptBracket/Brace">}</span>
            
            <span class="ActionScriptASDoc">/** Event handler to react on a finished trace. */</span>
            <span class="ActionScriptReserved">protected</span> <span class="ActionScriptfunction">function</span> <span class="ActionScriptDefault_Text">traceEndHandler</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span> : <span class="ActionScriptDefault_Text">TraceEvent</span><span class="ActionScriptBracket/Brace">)</span> : <span class="ActionScriptReserved">void</span>
            <span class="ActionScriptBracket/Brace">{</span>
                <span class="ActionScriptComment">// ignore empty traces
</span>                <span class="ActionScriptReserved">if</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptOperator">.</span><span class="ActionScripttrace">trace</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">length</span> <span class="ActionScriptOperator">==</span> 0<span class="ActionScriptBracket/Brace">)</span> <span class="ActionScriptReserved">return</span>;
                
                <span class="ActionScriptComment">// simply redraw the trace
</span>                <span class="ActionScriptDefault_Text">drawings</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">graphics</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">lineStyle</span><span class="ActionScriptBracket/Brace">(</span>1<span class="ActionScriptOperator">,</span> 0x000000<span class="ActionScriptBracket/Brace">)</span>;
                <span class="ActionScriptDefault_Text">drawings</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">graphics</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">moveTo</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptOperator">.</span><span class="ActionScripttrace">trace</span><span class="ActionScriptBracket/Brace">[</span>0<span class="ActionScriptBracket/Brace">]</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">x</span><span class="ActionScriptOperator">,</span> <span class="ActionScriptDefault_Text">event</span><span class="ActionScriptOperator">.</span><span class="ActionScripttrace">trace</span><span class="ActionScriptBracket/Brace">[</span>0<span class="ActionScriptBracket/Brace">]</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">y</span><span class="ActionScriptBracket/Brace">)</span>;  
                                
                <span class="ActionScriptReserved">for each</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptvar">var</span> <span class="ActionScriptDefault_Text">point</span> : <span class="ActionScriptDefault_Text">Point</span> <span class="ActionScriptReserved">in</span> <span class="ActionScriptDefault_Text">event</span><span class="ActionScriptOperator">.</span><span class="ActionScripttrace">trace</span><span class="ActionScriptBracket/Brace">)</span>
                <span class="ActionScriptBracket/Brace">{</span>
                    <span class="ActionScriptDefault_Text">drawings</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">graphics</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">lineTo</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">point</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">x</span><span class="ActionScriptOperator">,</span> <span class="ActionScriptDefault_Text">point</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">y</span><span class="ActionScriptBracket/Brace">)</span>;    
                <span class="ActionScriptBracket/Brace">}</span>
            <span class="ActionScriptBracket/Brace">}</span>
        <span class="ActionScriptBracket/Brace">]</span><span class="ActionScriptBracket/Brace">]</span><span class="ActionScriptOperator">&gt;</span>
    <span class="MXMLSpecial_Tag">&lt;/fx:Script&gt;</span>
    
    <span class="MXMLComment">&lt;!--</span><span class="MXMLComment"> layer to display drawn traces </span><span class="MXMLComment">--&gt;</span>
    <span class="MXMLComponent_Tag">&lt;s:Group</span><span class="MXMLDefault_Text"> id="</span><span class="MXMLString">drawings</span><span class="MXMLDefault_Text">" width="</span><span class="MXMLString">100%</span><span class="MXMLDefault_Text">" height="</span><span class="MXMLString">100%</span><span class="MXMLDefault_Text">" </span><span class="MXMLComponent_Tag">/&gt;</span>
    
    <span class="MXMLComment">&lt;!--</span><span class="MXMLComment"> the surface to draw on (registered handlers) </span><span class="MXMLComment">--&gt;</span>
    <span class="MXMLComponent_Tag">&lt;surface:DrawSurface</span><span class="MXMLDefault_Text"> id="</span><span class="MXMLString">surface</span><span class="MXMLDefault_Text">" 
                         x="</span><span class="MXMLString">0</span><span class="MXMLDefault_Text">" y="</span><span class="MXMLString">0</span><span class="MXMLDefault_Text">" 
                         width="</span><span class="MXMLString">100%</span><span class="MXMLDefault_Text">" height="</span><span class="MXMLString">100%</span><span class="MXMLDefault_Text">"
                         
                         useFading      = </span>"<span class="MXMLString">{</span><span class="ActionScriptDefault_Text">useFadingBox</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">selected</span><span class="MXMLString">}</span><span class="MXMLDefault_Text">" 
                         fadeDuration = </span>"<span class="MXMLString">{</span><span class="ActionScriptDefault_Text">durationSlider</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">value</span><span class="MXMLString">}</span><span class="MXMLDefault_Text">"
                         
                         traceStart = </span>"<span class="ActionScriptDefault_Text">traceStartHandler</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptBracket/Brace">)</span><span class="MXMLDefault_Text">"
                         traceEnd   = </span>"<span class="ActionScriptDefault_Text">traceEndHandler</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptDefault_Text">event</span><span class="ActionScriptBracket/Brace">)</span><span class="MXMLDefault_Text">" </span><span class="MXMLComponent_Tag">/&gt;</span>
    
    <span class="MXMLComment">&lt;!--</span><span class="MXMLComment"> Checkbox to activate fading </span><span class="MXMLComment">--&gt;</span>
    <span class="MXMLComponent_Tag">&lt;s:CheckBox</span><span class="MXMLDefault_Text"> id="</span><span class="MXMLString">useFadingBox</span><span class="MXMLDefault_Text">" label="</span><span class="MXMLString">Use Fading</span><span class="MXMLDefault_Text">"
                x="</span><span class="MXMLString">10</span><span class="MXMLDefault_Text">" y="</span><span class="MXMLString">10</span><span class="MXMLDefault_Text">"</span><span class="MXMLComponent_Tag">/&gt;</span>
    
    <span class="MXMLComment">&lt;!--</span><span class="MXMLComment"> Slider to select fading duration </span><span class="MXMLComment">--&gt;</span>
    <span class="MXMLComponent_Tag">&lt;s:HSlider</span><span class="MXMLDefault_Text"> id="</span><span class="MXMLString">durationSlider</span><span class="MXMLDefault_Text">"
               x="</span><span class="MXMLString">10</span><span class="MXMLDefault_Text">" y="</span><span class="MXMLString">36</span><span class="MXMLDefault_Text">"
               minimum="</span><span class="MXMLString">0</span><span class="MXMLDefault_Text">" maximum="</span><span class="MXMLString">10000</span><span class="MXMLDefault_Text">" value="</span><span class="MXMLString">2000</span><span class="MXMLDefault_Text">"
               visible="</span><span class="MXMLString">{</span><span class="ActionScriptDefault_Text">useFadingBox</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">selected</span><span class="MXMLString">}</span><span class="MXMLDefault_Text">" </span><span class="MXMLComponent_Tag">/&gt;</span>
    
    <span class="MXMLComment">&lt;!--</span><span class="MXMLComment"> Button to clear drawn traces </span><span class="MXMLComment">--&gt;</span>
    <span class="MXMLComponent_Tag">&lt;s:Button</span><span class="MXMLDefault_Text"> label="</span><span class="MXMLString">Clear</span><span class="MXMLDefault_Text">" 
              right="</span><span class="MXMLString">5</span><span class="MXMLDefault_Text">" bottom="</span><span class="MXMLString">5</span><span class="MXMLDefault_Text">" 
              click="</span><span class="ActionScriptDefault_Text">drawings</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">graphics</span><span class="ActionScriptOperator">.</span><span class="ActionScriptDefault_Text">clear</span><span class="ActionScriptBracket/Brace">(</span><span class="ActionScriptBracket/Brace">)</span><span class="MXMLDefault_Text">"</span><span class="MXMLComponent_Tag">/&gt;</span>
    
<span class="MXMLComponent_Tag">&lt;/s:Application&gt;</span></pre></body>
</html>
